<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<%@ include file="/WEB-INF/public/head.jsp" %>
	<title>修改资料</title>

	<script type="text/javascript" charset="utf-8" src="${system}/utf8-jsp/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="${system}/utf8-jsp/ueditor.all.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="${system}/utf8-jsp/lang/zh-cn/zh-cn.js"></script>

</head>
<script type="text/javascript">
    parent.initialize();//添加遮罩
  setTimeout(function(){
  	UE.getEditor('editor').setContent('${psr.context}', false);
      parent.subSomething();
  },3000);
	//实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');
      function getContent() {
        var content = UE.getEditor('editor').getContent();
      $("#context").val(content);
    }
    
      function save(){
        var file=$("#myfile");
           if($.trim(file.val())==''){
                  file.attr("name","");   
             }
      
       getContent();
       parent.initialize();
	  jquerySubByFId('resourcesaveform',save_callback,null,"json");
	  
  }
  //ajax调用的回调函数，ajax请求完成调用此函数，传入的参数是action返回的结果
  function save_callback(data){	
	  parent.subSomething();
	  parent.message_alert(data);
	   window.location.href="${system}/Success.jsp";
  }
  
 

</script>
</head>
<body>


	<form id="resourcesaveform" action="${system}/psr/upadtesubmit"
		method="post" enctype="multipart/form-data">
		<input type="hidden" name="id" value="${psr.id}"/>
		 <input type="hidden" name="context" value="" id="context"/>
        <table border=0 cellSpacing=0 cellPadding=0 width="100%"
			bgColor=#c4d8ed>
          <tbody>
             <tr>
			    <td background=images/r_0.gif width="100%">
						<table cellSpacing=0 cellPadding=0 width="100%">
							<tbody>
								<tr>
									<td>&nbsp;修改资料</td>
									<td align=right>&nbsp;</td>
								</tr>
							</tbody>
						</table>
				</td>
				</tr>
				<tr>
					<td>
						<TABLE class="toptable grid" border=1 cellSpacing=1 cellPadding=4
							align=center>
							<tbody>

								<tr>
									<td height=30 width="5%" align=right>标题：</td>
									<td class=category width="15%">
										<div>
											<input  type="text" id="title" name="title" style="width: 320px;" value="${psr.title}"/>
										</div> 
									<td height=30 width="5%" align=right>简介：</td>
									<td class=category width="55%">
										<div>
											<input  type="text" id="introduction" name="introduction" value="${psr.introduction}" style="width: 750px;"/>
										</div> 	
								</tr>
                                
                                <tr>
									<td height=30 width="5%" align=right>类型：</td>
									<td class=category width="15%">
										<div>
											<select name="typeid">
											 <c:forEach items="${typelist}" var="t">
											   <option value="${t.id}" <c:if test="${t.id eq psr.typeid}">selected="selected"</c:if>>${t.name}</option>
											   </c:forEach>
											</select>
										</div> 
									 <td height=30 width="5%" align=right>显示图片：</td>
									<td class=category width="15%">
										<div>
											<input type="radio" name="resource_type" value="3" <c:if test="${psr.resource_type eq 3}">checked="checked"</c:if>/>显示
										</div> 
								</tr>
								<tr>
								     <td height=30 width="5%" align=right>图片：</td>
									<td class=category width="15%">
										<div>
										     ${psr.resourceurl}
											 <input type="file" name="myfile" id="myfile"/>
										</div> 
								</tr>
							</tbody>
						</TABLE></td>
				</tr>
          </tbody>
		</table>
		<div>
    <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
   </div>
     <a id="submitbtn"  class="easyui-linkbutton"   iconCls="icon-ok" href="#" onclick="save()">提交</a>
	</form>
</body>
</html>